package com.lagou.edu.controller;

import com.lagou.edu.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @author 赵虎
 * @date 2021/4/1 1:34 上午
 */
@Controller
public class PayController {

    @Autowired
    private OrderService orderService;

    @RequestMapping("/pay/{orderId}")
    public String pay(@PathVariable Integer orderId, Model model) {
        boolean b = orderService.payOrder(orderId);
        model.addAttribute("orderId", orderId);
        return b ? "success" : "fail";
    }
}
